﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;
using System.Web.UI.MobileControls;

namespace FA_WCF
{
    // 注意: 如果更改此处的类名“Service1”，也必须更新 Web.config 和关联的 .svc 文件中对“Service1”的引用。
    public class Service_FA : IService_FA
    {
        #region IService_FA 成员

        public List<Teams> getAllTeams()
        {
            using (var db = new FADataContext())
            {
                var r = from t in db.GetTable<Teams>()
                        select t;
                return r.ToList();
            }
        }

        public Fixtures[] getFixturesByTeam(string team_id)
        {
            int id = int.Parse(team_id);
            using (var db = new FADataContext())
            {
                var r = from f in db.GetTable<Fixtures>()
                        where f.home_team ==  id || f.away_team==id
                        select f;
                return r.ToArray();
            }
        }

        #endregion
    }
}
